<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>系统登录</title>
<script type="text/javascript" src="../script/common.js"></script>
<script type="text/javascript" language="javascript" src="../script/common_stat.js"></script>

<style>
</style>

<script type="text/javascript">
	var crosstab = new Crosstab();
	
	var dimensions = {"province":"城市","org":{name:"所属机构",option:{"p500":"地市"}},"name":"客户名称","preGrade":"当前级别","nextGrade":"改变级别"}
	var measures = {"count":"数量"}
	var defaultHorizon = {"province":true,"org":{"p500":true},"name":true,"preGrade":true,"nextGrade":true}
	var defaultVertical = {}
	var defaultMeasure = {"count":true}
	var crossconf = {
		dimensions : dimensions,
		measures : measures,
		defaultMeasure : defaultMeasure,
		defaultVertical : defaultVertical,
		defaultHorizon : defaultHorizon
	}
	var pivot;

	function load(){
		Eui.showNavigation();
		setPages(["queryView","crosstabview"]);
		Eui.initDateInput("confirmDateId","确认日期","searchForm","confirmDate","_pastDate",true);
		searchForm.confirmDate.value = TX.Misc.getDateBefore(1);//默认日期,昨天
		pivot = new Pivot("crosstabview","upgrading_stat");		
		pivot.initConf(crossconf);
		pivot.setPivotHead('pivotTitle','客户升级查询统计');
	}
	function doQuery(){
		if(!checkForm("searchForm"))
				return;
			pivot.setPivotHead('statTime',Format.today(true));
		pivot.setPivotHead('statClass',"无");
		pivot.setPivotHead('beginTime','');
		pivot.setPivotHead('endTime','');
		pivot.param = paramFunc();
		pivot.refresh();
				
		switchPage("crosstabview");
		}
		function paramFunc(){
		var cOrg = Common.cOrg();
		searchForm.currentOrgLevel.value = cOrg.orgLevel;
		return Common.getValues(searchForm);
	}
	//选择单位控件
	function setOrg(sorg) {
		searchForm.orgLevel.value = sorg.orgLevel;
		searchForm.orgId.value = sorg.id;
		searchForm.orgName.value = sorg.name;
	}
		
</script>
</head>
	
	<body onload="load()">
		<div class="nav"><div id="nav">&nbsp;</div></div>
		<div id="getHtmlPrintdiv" style="display:none;"></div>
		<div id="queryView" class="searchForm">
		<div class="formTitle">客户升级统计：查询条件</div>
			<form id="searchForm" name="searchForm">
			<input type="hidden" name="orgId"/>
			<input type="hidden" name="orgLevel"/>
			<input type="hidden" name="currentOrg"/>
			<input type="hidden" name="currentOrgLevel"/>	
				<table cellSpacing="0" cellPadding="4" width="100%" border="0">
					<tr>
						<td>
						<label>所属机构</label>
						<input type="text" name="orgName" class="readonly" maxlength="20">
						<a class="orga" title="选择所属机构" href="javascript:void(0)" onclick="SystemMgnt.selOrg(setOrg)">&nbsp;&nbsp;</a>
						</td>
						<td id="confirmDateId"></td>
						<td><button onclick="doQuery()">查询报表</button>
						</td>
					</tr>
				</table>
			</form>
		</div>
		<div id="crosstabview" style="display:none;"></div>
		<div id="pirotView" style="display:none"></div>
	</body>
</html>
